package com.huangliusong.hlsinspringboot.service;

import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

/**
 * java7 for循环实现 {@link CalculatService}
 */
@Profile("java7")
@Service
public class Java7CalculatService implements  CalculatService {
    @Override
    public Integer sum(Integer... values) {
        int sum=0;
        for (int i=0;i<values.length;i++){
            sum+=values[i];
        }
        System.out.println("======基于java7方式计算=====");
        return sum;
    }

    public static void main(String[] args){
        Java7CalculatService java7CalculatService=new Java7CalculatService();
        System.out.println(java7CalculatService.sum(1,2,3,4,5,6,7,8,9,10));
    }

}
